Skip to content

feat(cli): add vesting-status command for validators#131

Merged
ipetrov22 merged 6 commits intodevelopfrom
475
Mar 7, 2026
Merged

feat(cli): add vesting-status command for validators#131
ipetrov22 merged 6 commits intodevelopfrom
475

Conversation

@ipetrov22
Copy link
Contributor

@ipetrov22 ipetrov22 commented Feb 12, 2026

Summary

  • Adds a new read-only hydragon vesting-status CLI command that lets validators check their vesting position status on-chain
  • Queries 4 view functions across HydraStaking and HydraDelegation contracts — no state changes, no gas costs
  • Displays: vesting period, start/end timestamps, base stake, bonuses, generated rewards, claimable rewards, and claimable commissions

Details

Resolves https://github.com/Hydra-Chain/hydragon-issues/issues/475

On-chain queries

Data Point Contract View Function
Vesting position (duration, start, end, base, bonuses, commission) HydraStaking (0x104) vestedStakingPositions(address)
Generated rewards HydraStaking (0x104) calculatePositionTotalReward(address)
Claimable rewards HydraStaking (0x104) unclaimedRewards(address)
Claimable commissions HydraDelegation (0x107) distributedCommissions(address)

Files changed

  • command/sidechain/vesting-status/params.go (new) — params struct, result struct, output formatting
  • command/sidechain/vesting-status/vesting_status.go (new) — command definition, ABI encoding/decoding, contract calls
  • command/sidechain/vesting-status/params_test.go (new) — unit tests for formatTimestamp, formatWei, validateFlags, GetOutput
  • command/sidechain/vesting-status/vesting_status_test.go (new) — mock-based unit tests for queryVestedStakingPositions, querySingleUint256, getVestingStatus
  • command/polybft/polybft_command.go (modified) — register the new subcommand

Usage

# With local secrets
polygon-edge hydragon vesting-status --data-dir /path/to/data --insecure --jsonrpc http://localhost:8545

# JSON output
polygon-edge hydragon vesting-status --data-dir /path/to/data --insecure --json

Example output (no active vesting)

[VESTING STATUS - NO ACTIVE POSITION]
Validator Address           = 0xf1CDeD1344cf05dD00EC87A1A5ADa6C76046B147
Generated Rewards (wei)     = 10489256352585140782466
Claimable Rewards (wei)     = 10489256352585140782466
Claimable Commissions (wei) = 0

🤖 Generated with Claude Code

Add read-only CLI command to query validator vesting status from on-chain
view functions. Displays vesting period, start/end timestamps, generated
rewards, claimable rewards, and claimable commissions.

Queries:
- vestedStakingPositions(addr) on HydraStaking
- calculatePositionTotalReward(addr) on HydraStaking
- unclaimedRewards(addr) on HydraStaking
- distributedCommissions(addr) on HydraDelegation

Closes #475

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ipetrov22 and others added 2 commits February 16, 2026 20:39
…+ add unit tests

- Remove dead WithReceiptTimeout (unused by Call-only command)
- Rename calculatePositionTotalReward → calculatePositionTotalRewardFn (consistency)
- Use Abi.Methods[] instead of Abi.GetMethod() (consistency with other sidechain cmds)
- Add GeneratedRewards to inactive-position human output (validators without vesting can have rewards)
- Add clarifying comment on distributedCommissions semantics
- Extract getVestingStatus() from runCommand for testability
- Add 15 unit tests covering formatTimestamp, formatWei, validateFlags, GetOutput, queryVestedStakingPositions, querySingleUint256, getVestingStatus

tests OK / health OK

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ipetrov22 ipetrov22 requested a review from R-Santev February 18, 2026 18:07
ipetrov22 and others added 3 commits February 23, 2026 19:16
Contract stores duration in seconds (durationWeeks * 604800). Convert
back to weeks before displaying so the output matches the label.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The commission field in vestedStakingPositions is always 0 for
self-staked validators (only populated for delegated vesting).
Remove it from the struct, display, and tests to avoid confusion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The unclaimedRewards contract function returns total minus claimed,
not the matured/claimable portion. Rename to avoid implying rewards
are immediately withdrawable (they're locked during active vesting).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ipetrov22 ipetrov22 merged commit 0dae3b4 into develop Mar 7, 2026
9 of 11 checks passed
@ipetrov22 ipetrov22 deleted the 475 branch March 7, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants